<?php
defined('BASEPATH') or die('forbidden');

class flashmove_controller extends Controller {

    function _init() {
        check_level(50, segment(0), segment(1), segment(2, 'index'));
    }

    function index() {
     if (is_submit()) {
            $rowdata = $_POST['row'];
            $str = array_to_stringparam($rowdata);
            $str = $rowdata['area_host'] . $str . "action=17";
            $strResult = vpost($str);
            //echo $strResult;
            $result=0;
            //操作失败或者连接失败
            if($strResult!='0' || $strResult===FALSE)
            {
                $result = 1;
				unset($rowdata);
                echo "<script>alert('".translate('C_TIPS_ERROR_TEXT')."')</script>";
            }
            else
            {
            	//更新数据表
            	$rowsql['host']=$rowdata['area_host'];
            	$rowsql['role_name']=$rowdata['role_name'];
            	$rowsql['action']	=17;
            	$rowsql['intervaltime']	='null';
            	$rowsql['state']		='1';
            	$rowsql['intime']		=time();
         		$id = $this->db->insert("manage_type", $rowsql);
                insert_log(translate('MENU_SEAL_FLASHMOVE'),translate('DEL'),NULL,$rowdata);
                echo "<script>alert('".translate('C_TIPS_SUCCESS_TEXT')."')</script>";
            }
            //echo $result;
            //cp_tips($result == 0 ? "success" : "error");
        }
        
        $data['row']=$rowdata;
        $this->view->assign("arealist", $this->form->select("row[area_host]", get_area_list_host(), '', array('id' => 'area_host')));
        $this->view->display("seal/flashmove/index",$data);
    }

}

?>
